import {config} from './config.js'
const HTTP = {
request:function(url,data={},method="GET"){
    return new Promise((resolve,reject)=>{
       uni.request({
        url:config.baseUrl+url,
        data:data,
        method:method,
        success:(res)=> {
          var code = res.statusCode.toString();
          if (code.charAt(0) == '2') {
            resolve(res.data);
          } else {
            reject()
          }
        }
      })
    })
  }
}
export { HTTP };
